<template>
	<view class="c-wrap">
		<view class="c-block">
			<!-- <view class="c-title">{{$t('clogin.label.notice')}}</view> -->

			<view class="c-album" @click="clickDetail" v-for="item in sr.list" :data-id="item.id" >
				<view class="c-album__avatar" >
					<image src="/static/assets/clogin/image/avatar.jpg" mode="" style="width: 35px;height: 35px;" ></image>
				</view>
				<view class="c-album__content" style="position: relative">
					<text class="c-title" >{{item.title}}</text>
					<view class="c-content">{{$t('clogin.label.publictime')}}: {{$u.timeFormat(item.publictime, 'yyyy/mm/dd hh:MM')}}</view>
					<view class="c-content">{{item.summary}}</view>
					<u-badge v-if="item.readtime==null" isDot type="warning" :offset="param.offset" absolute></u-badge>
				</view>
			</view>
			<view class="c-nodata" v-if="sr.list==null||sr.list.length==0">{{$t('ccore.label.nodata')}}</view>

		</view>
	</view>
</template>

<script>
	/*
		<datebarcomponent :id="sp.id" v-on:change="changeDatebar"></datebarcomponent>
		import datebarcomponent from '@/pages/csm/components/datebarcomponent.vue'
		components: {
			datebarcomponent
		},
	*/
	export default {
		props: {
			objectname: {
				type: String
			},
			objectid: {
				type: String
			},
		},
		data() {
			return {
				sp:{
				},
				param:{
					offset:[0,0]
				},
				sr:{
					list: []
				},
			}
		},
		created() {
			let that = this;
			that._initPage(); 
			uni.$on('onComponentShow', (data) => {
				that._initPage();
			})
		},
		methods: {
			_initPage(isForceDisplay) {
				let that = this;
				uni.setNavigationBarTitle({
					title: that.$t('clogin.tab.message')
				});
				that.$u.c.ajaxget('csmwj/cloginuser/pagenoticelisttemplate', {
					objectcode:that.objectname,
					objectid:that.objectid,
				}, function(res) {
					that.sr = res;
				});
			},
			clickDetail:function(e){
				let that = this;
				that.$u.route({
					url: '/pages/clogin/cloginnoticedetail',
					params: {
						id: e.currentTarget.dataset.id,
						// locales:e.currentTarget.dataset.locales,
					}
				});
			},	
		}
	}
</script>

<style lang="scss">


	.c-wrap {
		background-color: #C8C9CC !important;
	}

	.c-block {
		background-color: #fff !important;
		padding-bottom: 5px;
		margin-bottom: 2px;
	}
</style>
